package com.itheima.log;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Log {
    private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    private String timestamp;
    private String operation;
    private String threadName;

    public Log(String operation) {
        this.operation = operation;
        this.timestamp = DATE_FORMAT.format(new Date());
        this.threadName = Thread.currentThread().getName();
    }

    @Override
    public String toString() {
        return String.format("[%s] [%s] %s: %s", timestamp, threadName, operation, "操作成功");
    }
}
